package com.huawei.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

/**

 * 创建空白文件
 */
public class CreateFile1 {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        //conf.set("fs.defaultFS", "hdfs:// master:9000");
        FileSystem fs = FileSystem.get(conf);
        boolean create = fs.createNewFile(new Path("/user/test/hdfs/file10.txt"));
        System.out.println(create ? "创建成功":"创建失败,文件已经存在");
        fs.close();
    }
}